<?php
/**
 * Created by PhpStorm.
 * User: Mikkle
 * QQ:776329498
 * Date: 2018/4/4
 * Time: 17:56
 */

namespace mikkle\tp_wxpay\src;


use mikkle\tp_wxpay\base\WxpayServerBase;

/**
 * title 使用默认继承的方法就够了
 * User: Mikkle
 * QQ:776329498
 * Class Notify
 * @package mikkle\tp_wxpay\src
 */
class Notify extends WxpayServerBase
{

    /**
     *
     * @param bool $result
     * @param int $type 默认返回数组，由业务自己组装返回给微信
     *
     * @return array|string
     */
    public function returnResult($result = true, $type = 1)
    {
        if ($result) {
            $ret = ['return_code'=>'SUCCESS'];
            $this->setReturnParam("return_code", "SUCCESS");
        } else {
            $this->setReturnParam("return_code", "FAIL");
            $ret = ['return_code'=>'FAIL'];
        }

        return $type==1 ? $ret : $this->createXml();
    }


}